package com.yizhang.pattern.observer.jdk;

import java.util.Observable;

/**
 * @Author: yi.zhang
 * @CreateTime: 2025-08-25 11:31:05
 * @Description: 论坛
 */
public class Forum extends Observable {
    private final String name = "知乎";
    private static final Forum INSTANCE = new Forum();

    private Forum() {}

    public static Forum getInstance() {
        return INSTANCE;
    }

    public String getName() {
        return name;
    }

    /**
     * 发布
     * @param t
     */
    public <T> void publish(T t) {
        System.out.println(this.name + "上又有新的问题啦！！！");
        setChanged();
        notifyObservers(t);
    }

}
